package day02;

public class homework {
    public static void main(String[] args) {
        int[] arr = {4, 1, 6, 3, 9, 8};
        int[] newArr;
        newArr = copyArrRange(arr, 2, 4);
        System.out.println("newarr[]=");
        for (int i = 0; i < newArr.length; i++) {
            System.out.print(newArr[i]+", ");
        }
    }

    public static int[] copyArrRange(int[] arr, int from, int to) {
        int[] newarr = new int[to - from+1];
        for (int i = 0; i < newarr.length; i++) {
            newarr[i] = arr[from + i];
        }
        return newarr;
    }
}
